#include<iostream>
using namespace std;
namespace shiyue
{
	template<class T>
	struct _list_node
	{
		_list_node<T>* _next;
		_list_node<T>* _prev;
		 T _date;
		_list_node(const T& f = T())
		 :_next(nullptr)
		 ,_prev(nullptr)
		 ,_date(f)
		 {}
	};


	template<class T>
	struct list_itreator
	{
		typedef _list_node<T> Node;
		Node* _node;
		list_itreator(Node* node)
			:_node(node)
		{}
		T& operator*()
		{
			return _node->_date;
		}
		list_itreator<T>& operator++()
		{
			_node = _node->_next;
			return *this;
		}
		bool operator!=(const list_itreator& a)
		{
			return _node != a._node;
		}

	};
	template<class T>
	class list
	{
		typedef list_itreator<T> itreator;
	public:
		itreator begin()
		{
			return itreator(_head->_next);
		}
		itreator end()
		{
			return itreator(_head);
		}
		typedef _list_node<T> Node;
		    list(const T&a=T())
			:_head(new Node)
			{
				_head->_next = _head;
				_head->_prev = _head;
			}
			void push_back(const T& f)
			{
				Node* tail = _head->_prev;
				Node* newnode = new Node(f);
				newnode->_prev = tail;
				newnode->_next = _head;
				tail->_next = newnode;
				_head->_prev = newnode;
			}
	private:
		Node* _head;
	};



}